package ACM.red;

/**
 * @Author wwk
 * @DATE 2022/8/28 16:22
 */

import java.util.*;
public class first {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();  //大臣数量
        int m = scanner.nextInt();  //重要性方面数量
        int id = scanner.nextInt();  // 要帮忙的大臣序号
        int[][] events = new int[n][m];
        //大顶堆，
        PriorityQueue<int[]> queue =
                new PriorityQueue<>(new Comparator<int[]>() {
                    @Override
                    public int compare(int[] o1, int[] o2) {
                        if(o1[0]==o2[0]){
                            return o1[1]-o2[1];
                        }else{
                            return o2[0]-o1[0];
                        }
                    }
                });
        //排序
        for (int i = 0; i < events.length; i++){
            int sum = 0;
            for (int j = 0; j < events[i].length; j++){
                events[i][j] = scanner.nextInt();
                sum += events[i][j];
            }
            queue.offer(new int[]{sum, i});
        }
        int res = 0;
        while(!queue.isEmpty()){
            int[] ints = queue.poll();
            res++;
            if(ints[1] == id-1){
                break;
            }
        }
        System.out.println(res);

    }
}
